$(document).ready(function(){
	$.ajax({
		type : 'GET',
		dataType:"json",
		cache:false,
		async:false,
		url : "/cnmuseum/accessControlServlet.getAccessBar.do",
		error : function() {
			alertFunc('用户菜单信息失败！');
		},
		success : function(res) {
			if (res.status == "OK") {
				var menus = res.menu;
				var divhtml = "";
				var left_divhtml = "<div class='function_left'>";
				var right_divhtml = "<div class='function_right' style='overflow-y:auto;'>";
				for(var i=0;i<menus.length;i++){
					var menuobj = menus[i];
					var menuname = menuobj.menuName;
					left_divhtml+="<div class='function_left_modules'>"
						+"<a href='#dataCollect'>"+menuname+"</a>"
						+"</div>";
					
					var menuList = menuobj.menuList;
					right_divhtml+="<div class='function_right_specific' id='dataCollect'>"
						+"<div class='specific_top'>"
						+"<a href='#'><img src='"+menuList[0].imgpath+"'>"+menuname+"</a>"
						+"</div>";
					right_divhtml+=	  "<div class='specific_line'></div>"
						+"<div class='specific_real'>"
						+"<ul>";
					for(var j=0;j<menuList.length;j++){
						right_divhtml+=		"<li><a href="+menuList[j].url+">"+menuList[j].name+"</a></li>";
					}
					right_divhtml+="</ul></div></div>";
				}
				right_divhtml+="</div>";
				left_divhtml+="</div>";
				divhtml+=left_divhtml+right_divhtml;
				$(".function_mainbox").html(divhtml);
				

				setFunctionApdativeSize();
				var cacheClick = "#"+window.parent.functionNavClick; 	//获取点击leftdiv id全局变量
				if(cacheClick != '#'){
					displayStyle($(cacheClick));
				}
			}else if (res.status == "Failed") {
				window.href = "../entry.html";
			}
		}
	}); 
});
function setFunctionApdativeSize(){
	var ww = $(window).width();
	var wh = $(window).height();
	$('.function_mainbox').width(ww);
	$('.function_mainbox').height(wh);
	$('.function_left').width(142);   //142
	$('.function_left').height(wh);
	$('.function_right').width(ww-212);   //142(width)+50(margin-left)+20(margin-right)
	$('.function_right').height(wh-40);   //20(margin-top)+20(margin-bottom)
}
